博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
完成个人中心—导航标签
阅读量:7051 次
发布时间:2019-06-28

本文共 1170 字,大约阅读时间需要 3 分钟。

个人中心—视图函数带标签页面参数tag

@app.route('/usercenter/<user_id>/<tag>')
def usercenter(user_id, tag):
   if tag == ‘1':
       return render_template('usercenter1.html', **context)

@app.route('/usercenter/
/
')@loginFirstdef usercenter(user_id,tag): user = User.query.filter(User.id == user_id).first() context = { 'username':user.username, 'questions':user.questions, 'comments':user.comments } if tag =='question': return render_template('user question.html',**context) elif tag =='comment': return render_template('user comment.html', **context) else: return render_template('user information.html', **context)

个人中心—导航标签链接增加tag参数

<li role=“presentation”><a href=“{
{ url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">全部问答</a></li>

个人中心—有链接到个人中心页面的url增加tag参数

u <a href="{
{ url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{
{ session.get('user') }}</a>

 

转载于:https://www.cnblogs.com/951111ldj/p/8042607.html

你可能感兴趣的文章
Android程序员眼中世界上最遥远的距离
查看>>
vim
查看>>
MacOs 开发环境设置
查看>>
Mac os远程登录Linux与文件传输
查看>>
Java随机数使用注意事项
查看>>
AngularJs学习日记[3]:ng-init
查看>>
git 删除错误提交的commit
查看>>
java泛型中T、E、K、V、?等含义
查看>>
python 运行 MySQL-python libmysqlclient.so.18: cannot open shared object file: No such file
查看>>
视频播放器推荐
查看>>
[root@AY140716161543837722Z ~]# man top
查看>>
C语言基础及指针⑩预编译及jni.h分析
查看>>
java打开IE浏览器
查看>>
PHP中$this的使用情况
查看>>
webview页面随设备分辨率缩放
查看>>
调侃面向对象编程的23种设计模式
查看>>
8-pandas聚合运算
查看>>
Kd-Tree算法原理和开源实现代码
查看>>
Mac Lion 下轻松更换 Caplock 键和 Control 键的映射--用于提升ema...
查看>>
在LispBox环境上安装 portableaserve 的详细过程
查看>>